package com.wzy.service.imp;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wzy.dao.KtDao;
import com.wzy.entity.Kt;
import com.wzy.service.KtSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class KtServiceImpl implements KtSevice {
    private KtDao ktDao;
    @Autowired
    public KtServiceImpl(KtDao ktDao) {
        this.ktDao = ktDao;
    }

    @Override
    public PageInfo lists(int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        List<Kt> allPage = ktDao.lists();
        PageInfo pageInfo = new PageInfo(allPage);
        return pageInfo;

    }

    @Override
    public void save(Kt kt) {
        ktDao.save(kt);
    }

    @Override
    public Kt findById(Integer kid) {
        return ktDao.findById(kid);
    }

    @Override
    public void update(Kt kt) {
        ktDao.update(kt);
    }

    @Override
    public void delete(Integer kid) {
        ktDao.delete(kid);
    }
}
